LL_CRS_DeInit API migration ¶
The LL de-initialization function previously available in the
stm32tnxx_ll_crs.c
file within HAL1 is no longer present in HAL2.
In HAL2, all the LL source files (
stm32tnxx_ll_crs.c) have been removed, leaving only the LL header files (
stm32tnxx_ll_crs.h) that contain static inline functions.
If users need to de-initialize CRS using the LL layer, they have two methods:
Utilize STM32CubeMX2 Code Generation: Rely on STM32CubeMX2 to generate code with the LL layer for CRS de-initialization.
Replace manually the de-initialization function : Replace the
LL_CRS_DeInitfunction manually with equivalent sequences using the static inline functions provided in thestm32tnxx_ll_crs.hfile, tailored to their specific configuration and requirements.
This approach ensures that the de-initialization sequence is precisely addressing the given use case based on the LL static inline functions provided in the
stm32tnxx_ll_crs.h
header file.
Related concept: Remove stm32tnxx_ll_ppp.c files
Method 1: Utilize STM32CubeMX2 Code Generation ¶
LL CRS configuration panel ¶
Create a new project with the STM32CubeMX2, then start the initialization and the main configuration.
LL CRS main features configuration ¶
The CRS Main features block configure:
LL CRS NVIC configuration ¶
Configure the NVIC in case of an interrupt.
Generated CRS de-initialization sequence ¶
The CRS de-initialization sequence is generated in the
mx_crs_deinit
function in
mx_crs.c
file under
$YOUR_PROJECT_NAME$/$YOUR_PROJECT_NAME$_SW/generated/STM32Cube_CodeGen.
|
HAL1 |
HAL2 |
|---|---|
static void MX_CRS_DeInit(void)
{
LL_CRS_DeInit(void);
}
|
void mx_crs_deinit(void)
{
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_CRS);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_CRS);
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_CRS);
}
|
Method 2: Replace manually the de-initialization functions ¶
LL_CRS_DeInit() API migration ¶
According to the used CRS, Implement the precise calls to
LL_APB1_GRP1_ForceReset()
and
LL_APB1_GRP1_ReleaseReset().
|
HAL1 |
HAL2 |
|---|---|
LL_CRS_DeInit(void);
|
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_CRS);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_CRS);
|